package com.varian.mybatis.base;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.varian.mybatis.handler.LogicDeleteFieldTypeHandler;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author ben
 * @since 2024/6/23
 */
@Data
public class BaseEntity extends PrimaryKeyEntity {

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    @Version
    private Integer version;

    @TableField(value = "is_deleted", typeHandler = LogicDeleteFieldTypeHandler.class)
    @TableLogic(value = "'0'", delval = "'${@cn.hutool.core.util.IdUtil@nanoId(10)}'")
    private Boolean deleted;
}
